home *** CD-ROM | disk | FTP | other *** search
/ MacWorld 1995 November / Macworld Nov ’95.toast / Developers / Flex 2.5.2 / flex-2.5.2 / flex.skl < prev    next >
Encoding:
Text File  |  1995-06-29  |  28.1 KB  |  1,230 lines  |  [TEXT/MPS ]

  1. /***
  2.  *
  3.  * A lexical scanner generated by flex
  4.  * CEH - flex.skl modified by Christopher E. Hyde, 95-06-29 from v2.85 95/04/24
  5.  *
  6.  ***/
  7.  
  8. #define FLEX_SCANNER
  9. #define YY_FLEX_MAJOR_VERSION 2
  10. #define YY_FLEX_MINOR_VERSION 5
  11.  
  12. #ifdef macintosh
  13. #pragma segment FlexScanner
  14. #endif
  15.  
  16. %-
  17. #include <stdio.h>
  18. %*
  19.  
  20. // cfront 1.2 defines "c_plusplus" instead of "__cplusplus"
  21. #if defined(c_plusplus) && !defined(__cplusplus)
  22. #define __cplusplus
  23. #endif
  24.  
  25. %+
  26. #define    YY_C            "C"
  27. #define    YY_DECLARE(t)    t yyFlexLexer::
  28. %-
  29. #define    YY_C
  30. #define    YY_DECLARE(t)    static t 
  31. #define    istream            FILE
  32. %*
  33.  
  34. #define YY_USE_PROTOS    // Use prototypes in function declarations.
  35. #define YY_USE_CONST    // The "const" storage-class-modifier is valid.
  36.  
  37. #ifdef __cplusplus
  38.  
  39. #include <stdlib.h>
  40. %+
  41. class istream;
  42. #include <stream.h>    // CEH
  43. %*
  44. //#include <unistd.h>
  45.  
  46. #else    // ! __cplusplus
  47.  
  48. #if __STDC__
  49.  
  50. #endif    // __STDC__
  51. #endif    // ! __cplusplus
  52.  
  53. #ifdef YY_USE_CONST
  54. #define yyconst const
  55. #else
  56. #define yyconst
  57. #endif
  58.  
  59.  
  60. #ifdef YY_USE_PROTOS
  61. #define YY_PROTO(proto) proto
  62. #else
  63. #define YY_PROTO(proto) ()
  64. #endif
  65.  
  66. // Returned upon end-of-file.
  67. #define YY_NULL    0
  68.  
  69. /* Promotes a possibly negative, possibly signed char to an unsigned
  70.  * integer for use as an array index.  If the signed char is negative,
  71.  * we want to instead treat it as an 8-bit unsigned char, hence the
  72.  * double cast.
  73.  */
  74. #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
  75.  
  76. /* Enter a start condition.  This macro really ought to take a parameter,
  77.  * but we do it the disgusting crufty way forced on us by the ()-less
  78.  * definition of BEGIN.
  79.  */
  80. #define BEGIN yy_start = 1 + 2 *
  81.  
  82. /* Translate the current start state into a value that can be later handed
  83.  * to BEGIN to return to the state.  The YYSTATE alias is for lex
  84.  * compatibility.
  85.  */
  86. #define YY_START ((yy_start - 1) / 2)
  87. #define YYSTATE YY_START
  88.  
  89. // Action number for EOF rule of a given start state.
  90. #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
  91.  
  92. // Special action meaning "start processing a new file".
  93. #define YY_NEW_FILE yyrestart(yyin)
  94.  
  95. #define YY_END_OF_BUFFER_CHAR 0
  96.  
  97. // Size of default input buffer.
  98. #define YY_BUF_SIZE 16384
  99.  
  100. typedef struct yy_buffer_state* YY_BUFFER_STATE;
  101.  
  102. extern int yyleng;
  103. %-
  104. extern FILE *yyin, *yyout;
  105. %*
  106.  
  107. #define EOB_ACT_CONTINUE_SCAN    0
  108. #define EOB_ACT_END_OF_FILE        1
  109. #define EOB_ACT_LAST_MATCH        2
  110.  
  111. /* The funky do-while in the following #define is used to turn the definition
  112.  * int a single C statement (which needs a semi-colon terminator).  This
  113.  * avoids problems with code like:
  114.  *
  115.  *     if (condition_holds)
  116.  *        yyless(5);
  117.  *    else
  118.  *        do_something_else();
  119.  *
  120.  * Prior to using the do-while the compiler would get upset at the
  121.  * "else" because it interpreted the "if" statement as being all
  122.  * done when it reached the ';' after the yyless() call.
  123.  */
  124.  
  125. /* Return all but the first 'n' matched characters back to the input stream. */
  126.  
  127. #define yyless(n)    do { \
  128.         /* Undo effects of setting up yytext. */ \
  129.         *yy_cp = yy_hold_char; \
  130.         yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \
  131.         YY_DO_BEFORE_ACTION; /* set up yytext again */ \
  132.     } while (0)
  133.  
  134. #define unput(c)    yyunput(c, yytext_ptr)
  135.  
  136. /* The following is because we cannot portably get our hands on size_t
  137.  * (without autoconf's help, which isn't available because we want
  138.  * flex-generated scanners to compile on their own).
  139.  */
  140. typedef unsigned int yy_size_t;
  141.  
  142.  
  143. struct yy_buffer_state {
  144.     istream* yy_input_file;
  145.     char*    yy_ch_buf;        // input buffer
  146.     char*    yy_buf_pos;        // current position in input buffer
  147.  
  148.     // Size of input buffer in bytes, not including room for EOB characters.
  149.     yy_size_t yy_buf_size;
  150.  
  151.     // Number of characters read into yy_ch_buf, not including EOB characters.
  152.     int yy_n_chars;
  153.  
  154.     /* Whether we "own" the buffer - i.e., we know we created it, and
  155.      * can realloc() it to grow it, and should free() it to delete it.
  156.      */
  157.     int yy_is_our_buffer;
  158.  
  159.     /* Whether this is an "interactive" input source; if so, and if we're
  160.      * using stdio for input, then we want to use getc() instead of
  161.      * fread(), to make sure we stop fetching input after each newline.
  162.      */
  163.     int yy_is_interactive;
  164.  
  165.     /* Whether we're considered to be at the beginning of a line.
  166.      * If so, '^' rules will be active on the next match, otherwise not.
  167.      */
  168.     int yy_at_bol;
  169.  
  170.     // Whether to try to fill the input buffer when we reach the end of it.
  171.     int yy_fill_buffer;
  172.  
  173.     int yy_buffer_status;
  174. #define YY_BUFFER_NEW        0
  175. #define YY_BUFFER_NORMAL    1
  176.     /* When an EOF's been seen but there's still some text to process
  177.      * then we mark the buffer as YY_EOF_PENDING, to indicate that we
  178.      * shouldn't try reading from the input source any more.  We might
  179.      * still have a bunch of tokens to match, though, because of
  180.      * possible backing-up.
  181.      *
  182.      * When we actually see the EOF, we change the status to "new"
  183.      * (via yyrestart()), so that the user can continue scanning by
  184.      * just pointing yyin at a new input file.
  185.      */
  186. #define YY_BUFFER_EOF_PENDING 2
  187. };
  188.  
  189. %- Standard (non-C++) definition
  190. static YY_BUFFER_STATE yy_current_buffer = 0;
  191. %*
  192.  
  193. /* We provide macros for accessing buffer states in case in the
  194.  * future we want to put the buffer states in a more general
  195.  * "scanner state".
  196.  */
  197. #define YY_CURRENT_BUFFER yy_current_buffer
  198.  
  199.  
  200. %- Standard (non-C++) definition
  201. // yy_hold_char holds the character lost when yytext is formed.
  202. static char yy_hold_char;
  203.  
  204. static int yy_n_chars;        // number of characters read into yy_ch_buf
  205.  
  206.  
  207. int yyleng;
  208.  
  209. // Points to current character in buffer.
  210. static char* yy_c_buf_p = (char*) 0;
  211. static int yy_init    = 1;    // whether we need to initialize
  212. static int yy_start    = 0;    // start state number
  213.  
  214. /* Flag which is used to allow yywrap()'s to do buffer switches
  215.  * instead of setting up a fresh yyin.  A bit of a hack ...
  216.  */
  217. static int yy_did_buffer_switch_on_eof;
  218.  
  219. void yyrestart                    (istream* input_file);
  220.  
  221. void yy_switch_to_buffer        (YY_BUFFER_STATE new_buffer);
  222. void yy_load_buffer_state        (void);
  223. YY_BUFFER_STATE yy_create_buffer(istream* file, int size);
  224. void yy_delete_buffer            (YY_BUFFER_STATE b);
  225. void yy_init_buffer                (YY_BUFFER_STATE b, istream* file);
  226. void yy_flush_buffer            (YY_BUFFER_STATE b);
  227. #define YY_FLUSH_BUFFER yy_flush_buffer(yy_current_buffer)
  228.  
  229. YY_BUFFER_STATE yy_scan_buffer    (char* base, yy_size_t size);
  230. YY_BUFFER_STATE yy_scan_string    (yyconst char* str);
  231. YY_BUFFER_STATE yy_scan_bytes    (yyconst char* bytes, int len);
  232. %*
  233.  
  234. static void*    yy_flex_alloc    (yy_size_t);
  235. static void*    yy_flex_realloc    (void*, yy_size_t);
  236. static void        yy_flex_free    (void*);
  237.  
  238. #define yy_new_buffer    yy_create_buffer
  239.  
  240. #define yy_set_interactive(is_interactive)    { \
  241.     if ( ! yy_current_buffer ) \
  242.         yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
  243.     yy_current_buffer->yy_is_interactive = is_interactive; \
  244.     }
  245.  
  246. #define yy_set_bol(at_bol)    { \
  247.     if ( ! yy_current_buffer ) \
  248.         yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
  249.     yy_current_buffer->yy_at_bol = at_bol; \
  250.     }
  251.  
  252. #define YY_AT_BOL() (yy_current_buffer->yy_at_bol)
  253.  
  254. %% yytext/yyin/yyout/yy_state_type/yylineno etc. def's & init go here
  255.  
  256. %- Standard (non-C++) definition
  257. static yy_state_type    yy_get_previous_state    (void);
  258. static yy_state_type    yy_try_NUL_trans        (yy_state_type current_state);
  259. static int                yy_get_next_buffer        (void);
  260. static void                yy_fatal_error            (yyconst char msg[]);
  261. %*
  262.  
  263. /* Done after the current pattern has been matched and before the
  264.  * corresponding action - sets up yytext.
  265.  */
  266. #define    YY_DO_BEFORE_ACTION    yytext_ptr = yy_bp; \
  267. %% code to fiddle yytext and yyleng for yymore() goes here
  268.     yy_hold_char = *yy_cp; \
  269.     *yy_cp = '\0'; \
  270. %% code to copy yytext_ptr to yytext[] goes here, if %array
  271.     yy_c_buf_p = yy_cp;
  272.  
  273. %% data tables for the DFA and the user's section 1 definitions go here
  274.  
  275. /* Macros after this point can all be overridden by user definitions in
  276.  * section 1.
  277.  */
  278.  
  279. #ifndef YY_SKIP_YYWRAP
  280. extern YY_C int yywrap (void);
  281. #endif
  282.  
  283. %-
  284. #ifndef YY_NO_UNPUT
  285. static void yyunput (int c, char* buf_ptr);
  286. #endif
  287. %*
  288.  
  289. #ifndef yytext_ptr
  290. static void yy_flex_strncpy (char*, yyconst char*, int);
  291. #endif
  292.  
  293. #ifndef YY_NO_INPUT
  294. static int yyinput (void);
  295. #endif
  296.  
  297. #if YY_STACK_USED
  298. static int yy_start_stack_ptr    = 0;
  299. static int yy_start_stack_depth    = 0;
  300. static int *yy_start_stack        = 0;
  301. #ifndef YY_NO_PUSH_STATE
  302. static void yy_push_state    (int new_state);
  303. #endif
  304. #ifndef YY_NO_POP_STATE
  305. static void yy_pop_state    (void);
  306. #endif
  307. #ifndef YY_NO_TOP_STATE
  308. static int yy_top_state        (void);
  309. #endif
  310.  
  311. #else
  312. #define YY_NO_PUSH_STATE    1
  313. #define YY_NO_POP_STATE        1
  314. #define YY_NO_TOP_STATE        1
  315. #endif
  316.  
  317. #ifdef YY_MALLOC_DECL
  318. YY_MALLOC_DECL
  319. #else
  320. #if __STDC__
  321. #ifndef __cplusplus
  322. #include <stdlib.h>
  323. #endif
  324. #else
  325. /* Just try to get by without declaring the routines.  This will fail
  326.  * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int)
  327.  * or sizeof(void*) != sizeof(int).
  328.  */
  329. #endif
  330. #endif
  331.  
  332. // Amount of stuff to slurp up with each read.
  333. #ifndef YY_READ_BUF_SIZE
  334. #define YY_READ_BUF_SIZE 8192
  335. #endif
  336.  
  337. // Copy whatever the last rule matched to the standard output.
  338.  
  339. #ifndef ECHO
  340. %- Standard (non-C++) definition
  341. /* This used to be an fputs(), but since the string might contain NUL's,
  342.  * we now use fwrite().
  343.  */
  344. #define ECHO    (void) fwrite(yytext, yyleng, 1, yyout)
  345. %+ C++ definition
  346. #define ECHO    LexerOutput(yytext, yyleng)
  347. %*
  348. #endif
  349.  
  350. /* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
  351.  * is returned in "result".
  352.  */
  353. #ifndef YY_INPUT
  354. #define YY_INPUT(buf,result,max_size) \
  355. %% fread()/read() definition of YY_INPUT goes here unless we're doing C++
  356. %+ C++ definition
  357.     if ( (result = LexerInput( (char *) buf, max_size )) < 0 ) \
  358.         YY_FATAL_ERROR( "input in flex scanner failed" );
  359. %*
  360. #endif
  361.  
  362. /* No semi-colon after return; correct usage is to write "yyterminate();" -
  363.  * we don't want an extra ';' after the "return" because that will cause
  364.  * some compilers to complain about unreachable statements.
  365.  */
  366. #ifndef yyterminate
  367. #define yyterminate() return YY_NULL
  368. #endif
  369.  
  370. // Number of entries by which start-condition stack grows.
  371. #ifndef YY_START_STACK_INCR
  372. #define YY_START_STACK_INCR 25
  373. #endif
  374.  
  375. // Report a fatal error.
  376. #ifndef YY_FATAL_ERROR
  377. %-
  378. #define YY_FATAL_ERROR(msg) yy_fatal_error(msg)
  379. %+
  380. #define YY_FATAL_ERROR(msg) LexerError(msg)
  381. %*
  382. #endif
  383.  
  384. /* Default declaration of generated scanner - a define so the user can
  385.  * easily add parameters.
  386.  */
  387. #ifndef YY_DECL
  388. #define YY_DECL    YY_DECLARE(int) yylex()
  389. #endif
  390.  
  391. /* Code executed at the beginning of each rule, after yytext and yyleng
  392.  * have been set up.
  393.  */
  394. #ifndef YY_USER_ACTION
  395. #define YY_USER_ACTION
  396. #endif
  397.  
  398. // Code executed at the end of each rule.
  399. #ifndef YY_BREAK
  400. #define YY_BREAK break;
  401. #endif
  402.  
  403. %% YY_RULE_SETUP definition goes here
  404.  
  405. YY_DECL
  406. {
  407.     register yy_state_type yy_current_state;
  408.     register char *yy_cp, *yy_bp;
  409.     register int yy_act;
  410.  
  411. %% user's declarations go here
  412.  
  413.     if ( yy_init ) {
  414.         yy_init = 0;
  415.  
  416. #ifdef YY_USER_INIT
  417.         YY_USER_INIT;
  418. #endif
  419.  
  420.         if ( ! yy_start )
  421.             yy_start = 1;    /* first start state */
  422.  
  423.         if ( ! yyin )
  424. %-
  425.             yyin = stdin;
  426. %+
  427.             yyin = &cin;
  428. %*
  429.  
  430.         if ( ! yyout )
  431. %-
  432.             yyout = stdout;
  433. %+
  434.             yyout = &cout;
  435. %*
  436.  
  437.         if ( ! yy_current_buffer )
  438.             yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE );
  439.  
  440.         yy_load_buffer_state();
  441.     }
  442.  
  443.     while (1) {        // loops until end-of-file is reached
  444. %% yymore()-related code goes here
  445.         yy_cp = yy_c_buf_p;
  446.  
  447.         // Support of yytext.
  448.         *yy_cp = yy_hold_char;
  449.  
  450.         /* yy_bp points to the position in yy_ch_buf of the start of
  451.          * the current run.
  452.          */
  453.         yy_bp = yy_cp;
  454.  
  455. %% code to set up and find next match goes here
  456.  
  457. yy_find_action:
  458. %% code to find the action number goes here
  459.  
  460.         YY_DO_BEFORE_ACTION;
  461.  
  462. %% code for yylineno update goes here
  463.  
  464. do_action:    // This label is used only to access EOF actions.
  465.  
  466. %% debug code goes here
  467.  
  468.         switch (yy_act) { // beginning of action switch
  469. %% actions go here
  470.  
  471.     case YY_END_OF_BUFFER: {
  472.         // Amount of text matched not including the EOB char.
  473.         int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1;
  474.  
  475.         // Undo the effects of YY_DO_BEFORE_ACTION.
  476.         *yy_cp = yy_hold_char;
  477.  
  478.         if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW ) {
  479.             /* We're scanning a new file or input source.  It's
  480.              * possible that this happened because the user
  481.              * just pointed yyin at a new source and called
  482.              * yylex().  If so, then we have to assure
  483.              * consistency between yy_current_buffer and our
  484.              * globals.  Here is the right place to do so, because
  485.              * this is the first action (other than possibly a
  486.              * back-up) that will match for the new input source.
  487.              */
  488.             yy_n_chars = yy_current_buffer->yy_n_chars;
  489.             yy_current_buffer->yy_input_file = yyin;
  490.             yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL;
  491.         }
  492.  
  493.         /* Note that here we test for yy_c_buf_p "<=" to the position
  494.          * of the first EOB in the buffer, since yy_c_buf_p will
  495.          * already have been incremented past the NUL character
  496.          * (since all states make transitions on EOB to the
  497.          * end-of-buffer state).  Contrast this with the test
  498.          * in yyinput().
  499.          */
  500.         if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] ) {
  501.             // This was really a NUL.
  502.             yy_state_type yy_next_state;
  503.  
  504.             yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text;
  505.  
  506.             yy_current_state = yy_get_previous_state();
  507.  
  508.             /* Okay, we're now positioned to make the NUL
  509.              * transition.  We couldn't have
  510.              * yy_get_previous_state() go ahead and do it
  511.              * for us because it doesn't know how to deal
  512.              * with the possibility of jamming (and we don't
  513.              * want to build jamming into it because then it
  514.              * will run more slowly).
  515.              */
  516.  
  517.             yy_next_state = yy_try_NUL_trans( yy_current_state );
  518.  
  519.             yy_bp = yytext_ptr + YY_MORE_ADJ;
  520.  
  521.             if ( yy_next_state ) {
  522.                 /* Consume the NUL. */
  523.                 yy_cp = ++yy_c_buf_p;
  524.                 yy_current_state = yy_next_state;
  525.                 goto yy_match;
  526.             } else {
  527. %% code to do back-up for compressed tables and set up yy_cp goes here
  528.                 goto yy_find_action;
  529.             }
  530.         } else
  531.             switch ( yy_get_next_buffer() ) {
  532.             case EOB_ACT_END_OF_FILE: {
  533.                 yy_did_buffer_switch_on_eof = 0;
  534.  
  535.                 if ( yywrap() ) {
  536.                     /* Note: because we've taken care in
  537.                      * yy_get_next_buffer() to have set up
  538.                      * yytext, we can now set up
  539.                      * yy_c_buf_p so that if some total
  540.                      * hoser (like flex itself) wants to
  541.                      * call the scanner after we return the
  542.                      * YY_NULL, it'll still work - another
  543.                      * YY_NULL will get returned.
  544.                      */
  545.                     yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;
  546.  
  547.                     yy_act = YY_STATE_EOF(YY_START);
  548.                     goto do_action;
  549.                 } else {
  550.                     if ( ! yy_did_buffer_switch_on_eof )
  551.                         YY_NEW_FILE;
  552.                 }
  553.                 break;
  554.             }
  555.  
  556.             case EOB_ACT_CONTINUE_SCAN:
  557.                 yy_c_buf_p =
  558.                     yytext_ptr + yy_amount_of_matched_text;
  559.  
  560.                 yy_current_state = yy_get_previous_state();
  561.  
  562.                 yy_cp = yy_c_buf_p;
  563.                 yy_bp = yytext_ptr + YY_MORE_ADJ;
  564.                 goto yy_match;
  565.  
  566.             case EOB_ACT_LAST_MATCH:
  567.                 yy_c_buf_p =
  568.                 &yy_current_buffer->yy_ch_buf[yy_n_chars];
  569.  
  570.                 yy_current_state = yy_get_previous_state();
  571.  
  572.                 yy_cp = yy_c_buf_p;
  573.                 yy_bp = yytext_ptr + YY_MORE_ADJ;
  574.                 goto yy_find_action;
  575.             }
  576.         break;
  577.     }
  578.  
  579.         default:
  580.             YY_FATAL_ERROR(    "fatal flex scanner internal error--no action found" );
  581.         } // end of action switch
  582.     } // end of scanning one token
  583. } // end of yylex
  584.  
  585.  
  586. %+
  587. YY_DECLARE(;) yyFlexLexer (istream* arg_yyin, ostream* arg_yyout)
  588. {
  589.     yyin = arg_yyin;
  590.     yyout = arg_yyout;
  591.     yy_c_buf_p = 0;
  592.     yy_init = 1;
  593.     yy_start = 0;
  594.     yy_flex_debug = 0;
  595.     yylineno = 1;    // this will only get updated if %option yylineno
  596.  
  597.     yy_did_buffer_switch_on_eof = 0;
  598.  
  599.     yy_looking_for_trail_begin = 0;
  600.     yy_more_flag = 0;
  601.     yy_more_len = 0;
  602.  
  603.     yy_start_stack_ptr = yy_start_stack_depth = 0;
  604.     yy_start_stack = 0;
  605.  
  606.     yy_current_buffer = 0;
  607.  
  608. #ifdef YY_USES_REJECT
  609.     yy_state_buf = new yy_state_type[YY_BUF_SIZE + 2];
  610. #else
  611.     yy_state_buf = 0;
  612. #endif
  613. }
  614.  
  615.  
  616. YY_DECLARE(;) ~yyFlexLexer (void)
  617. {
  618.     delete yy_state_buf;
  619.     yy_delete_buffer( yy_current_buffer );
  620. }
  621.  
  622.  
  623. YY_DECLARE(void) switch_streams (istream* new_in, ostream* new_out)
  624. {
  625.     if (new_in) {
  626.         yy_delete_buffer(yy_current_buffer);
  627.         yy_switch_to_buffer(yy_create_buffer(new_in, YY_BUF_SIZE));
  628.     }
  629.  
  630.     if (new_out)
  631.         yyout = new_out;
  632. }
  633.  
  634.  
  635. YY_DECLARE(int) LexerInput (char* buf, int
  636. #ifndef YY_INTERACTIVE
  637.     max_size
  638. #endif
  639. )
  640. {
  641.     if (yyin->eof() || yyin->fail())
  642.         return 0;
  643.  
  644. #ifdef YY_INTERACTIVE
  645.     yyin->get(buf[0]);
  646.  
  647.     if (yyin->eof())
  648.         return 0;
  649.  
  650.     if (yyin->bad())
  651.         return -1;
  652.  
  653.     return 1;
  654. #else
  655.     (void) yyin->read(buf, max_size);
  656.  
  657.     return yyin->bad() ? -1 : yyin->gcount();
  658. #endif
  659. }
  660.  
  661.  
  662. YY_DECLARE(void) LexerOutput (const char* buf, int size)
  663. {
  664.     (void) yyout->write(buf, size);
  665. }
  666. %*
  667.  
  668.  
  669. /* yy_get_next_buffer - try to read in a new buffer
  670.  *
  671.  * Returns a code representing an action:
  672.  *    EOB_ACT_LAST_MATCH -
  673.  *    EOB_ACT_CONTINUE_SCAN - continue scanning from current position
  674.  *    EOB_ACT_END_OF_FILE - end of file
  675.  */
  676.  
  677. YY_DECLARE(int) yy_get_next_buffer (void)
  678. {
  679.     register char* dest = yy_current_buffer->yy_ch_buf;
  680.     register char* source = yytext_ptr;
  681.     register int number_to_move, i;
  682.     int ret_val;
  683.  
  684.     if (yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1])
  685.         YY_FATAL_ERROR("fatal flex scanner internal error--end of buffer missed");
  686.  
  687.     if (yy_current_buffer->yy_fill_buffer == 0) {
  688.         // Don't try to fill the buffer, so this is an EOF.
  689.         if (yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1) {
  690.             /* We matched a singled characater, the EOB, so
  691.              * treat this as a final EOF.
  692.              */
  693.             return EOB_ACT_END_OF_FILE;
  694.         }
  695.  
  696.         else {
  697.             // We matched some text prior to the EOB, first process it.
  698.             return EOB_ACT_LAST_MATCH;
  699.         }
  700.     }
  701.  
  702.     // Try to read more data.
  703.  
  704.     // First move last chars to start of buffer.
  705.     number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1;
  706.  
  707.     for (i = 0; i < number_to_move; ++i)
  708.         *(dest++) = *(source++);
  709.  
  710.     if (yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING)
  711.         /* don't do the read, it's not guaranteed to return an EOF,
  712.          * just force an EOF
  713.          */
  714.         yy_n_chars = 0;
  715.     else {
  716.         int num_to_read = yy_current_buffer->yy_buf_size - number_to_move - 1;
  717.  
  718.         while (num_to_read <= 0) {
  719.             // Not enough room in the buffer - grow it.
  720. #ifdef YY_USES_REJECT
  721.             YY_FATAL_ERROR(
  722.             "input buffer overflow, can't enlarge buffer because scanner uses REJECT");
  723. #else
  724.  
  725.             // just a shorter name for the current buffer
  726.             YY_BUFFER_STATE b = yy_current_buffer;
  727.  
  728.             int yy_c_buf_p_offset = (int) (yy_c_buf_p - b->yy_ch_buf);
  729.  
  730.             if (b->yy_is_our_buffer) {
  731.                 int new_size = b->yy_buf_size * 2;
  732.  
  733.                 if (new_size <= 0)
  734.                     b->yy_buf_size += b->yy_buf_size / 8;
  735.                 else
  736.                     b->yy_buf_size *= 2;
  737.  
  738.                 b->yy_ch_buf = (char*)
  739.                     // Include room in for 2 EOB chars.
  740.                     yy_flex_realloc((void*) b->yy_ch_buf, b->yy_buf_size + 2);
  741.             } else
  742.                 // Can't grow it, we don't own it.
  743.                 b->yy_ch_buf = 0;
  744.  
  745.             if (!b->yy_ch_buf)
  746.                 YY_FATAL_ERROR("fatal error - scanner input buffer overflow");
  747.  
  748.             yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
  749.  
  750.             num_to_read = yy_current_buffer->yy_buf_size - number_to_move - 1;
  751. #endif
  752.         }
  753.  
  754.         if (num_to_read > YY_READ_BUF_SIZE)
  755.             num_to_read = YY_READ_BUF_SIZE;
  756.  
  757.         // Read in more data.
  758.         YY_INPUT((&yy_current_buffer->yy_ch_buf[number_to_move]),
  759.                     yy_n_chars, num_to_read);
  760.     }
  761.  
  762.     if (yy_n_chars == 0) {
  763.         if (number_to_move == YY_MORE_ADJ) {
  764.             ret_val = EOB_ACT_END_OF_FILE;
  765.             yyrestart(yyin);
  766.         } else {
  767.             ret_val = EOB_ACT_LAST_MATCH;
  768.             yy_current_buffer->yy_buffer_status = YY_BUFFER_EOF_PENDING;
  769.         }
  770.     } else
  771.         ret_val = EOB_ACT_CONTINUE_SCAN;
  772.  
  773.     yy_n_chars += number_to_move;
  774.     yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
  775.     yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
  776.  
  777.     yytext_ptr = &yy_current_buffer->yy_ch_buf[0];
  778.  
  779.     return ret_val;
  780. }
  781.  
  782.  
  783. // yy_get_previous_state - get the state just before the EOB char was reached
  784.  
  785. YY_DECLARE(yy_state_type) yy_get_previous_state (void)
  786. {
  787.     register yy_state_type yy_current_state;
  788.     register char* yy_cp;
  789.  
  790. %% code to get the start state into yy_current_state goes here
  791.  
  792.     for (yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp) {
  793. %% code to find the next state goes here
  794.     }
  795.  
  796.     return yy_current_state;
  797. }
  798.  
  799.  
  800. /* yy_try_NUL_trans - try to make a transition on the NUL character
  801.  *
  802.  * synopsis
  803.  *    next_state = yy_try_NUL_trans(current_state);
  804.  */
  805.  
  806. YY_DECLARE(yy_state_type) yy_try_NUL_trans(yy_state_type yy_current_state)
  807. {
  808.     register int yy_is_jam;
  809. %% code to find the next state, and perhaps do backing up, goes here
  810.  
  811.     return yy_is_jam ? 0 : yy_current_state;
  812. }
  813.  
  814.  
  815. %-
  816. #ifndef YY_NO_UNPUT
  817. %*
  818. YY_DECLARE(void) yyunput (int c, register char* yy_bp)
  819. {
  820.     register char* yy_cp = yy_c_buf_p;
  821.  
  822.     // undo effects of setting up yytext
  823.     *yy_cp = yy_hold_char;
  824.  
  825.     if (yy_cp < yy_current_buffer->yy_ch_buf + 2) {
  826.         // need to shift things up to make room
  827.         // +2 for EOB chars.
  828.         register int number_to_move = yy_n_chars + 2;
  829.         register char *dest = &yy_current_buffer->yy_ch_buf[
  830.                                     yy_current_buffer->yy_buf_size + 2];
  831.         register char* source = &yy_current_buffer->yy_ch_buf[number_to_move];
  832.  
  833.         while (source > yy_current_buffer->yy_ch_buf)
  834.             *--dest = *--source;
  835.  
  836.         yy_cp += (int) (dest - source);
  837.         yy_bp += (int) (dest - source);
  838.         yy_n_chars = yy_current_buffer->yy_buf_size;
  839.  
  840.         if (yy_cp < yy_current_buffer->yy_ch_buf + 2)
  841.             YY_FATAL_ERROR("flex scanner push-back overflow");
  842.     }
  843.  
  844.     *--yy_cp = (char) c;
  845.  
  846. %% update yylineno here
  847.  
  848.     yytext_ptr = yy_bp;
  849.     yy_hold_char = *yy_cp;
  850.     yy_c_buf_p = yy_cp;
  851. }
  852. %-
  853. #endif    // ifndef YY_NO_UNPUT
  854. %*
  855.  
  856.  
  857. YY_DECLARE(int) yyinput (void)
  858. {
  859.     int c;
  860.  
  861.     *yy_c_buf_p = yy_hold_char;
  862.  
  863.     if (*yy_c_buf_p == YY_END_OF_BUFFER_CHAR) {
  864.         /* yy_c_buf_p now points to the character we want to return.
  865.          * If this occurs *before* the EOB characters, then it's a
  866.          * valid NUL; if not, then we've hit the end of the buffer.
  867.          */
  868.         if (yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars])
  869.             *yy_c_buf_p = '\0';            // This was really a NUL.
  870.         else { // need more input
  871.             yytext_ptr = yy_c_buf_p;
  872.             ++yy_c_buf_p;
  873.  
  874.             switch (yy_get_next_buffer()) {
  875.                 case EOB_ACT_END_OF_FILE: {
  876.                     if (yywrap()) {
  877.                         yy_c_buf_p =
  878.                         yytext_ptr + YY_MORE_ADJ;
  879.                         return EOF;
  880.                     }
  881.  
  882.                     if (!yy_did_buffer_switch_on_eof)
  883.                         YY_NEW_FILE;
  884.                     return yyinput();
  885.                 }
  886.  
  887.                 case EOB_ACT_CONTINUE_SCAN:
  888.                     yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;
  889.                     break;
  890.  
  891.                 case EOB_ACT_LAST_MATCH:
  892.                     YY_FATAL_ERROR("unexpected last match in yyinput()");
  893.             }
  894.         }
  895.     }
  896.  
  897.     c = *(unsigned char*) yy_c_buf_p;    // cast for 8-bit char's
  898.     *yy_c_buf_p = '\0';                    // preserve yytext
  899.     yy_hold_char = *++yy_c_buf_p;
  900.  
  901. %% update BOL and yylineno
  902.  
  903.     return c;
  904. }
  905.  
  906.  
  907. YY_DECLARE(void) yyrestart (istream* input_file)
  908. {
  909.     if ( ! yy_current_buffer )
  910.         yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE );
  911.  
  912.     yy_init_buffer( yy_current_buffer, input_file );
  913.     yy_load_buffer_state();
  914. }
  915.  
  916.  
  917. YY_DECLARE(void) yy_switch_to_buffer (YY_BUFFER_STATE new_buffer)
  918. {
  919.     if (yy_current_buffer == new_buffer)
  920.         return;
  921.  
  922.     if (yy_current_buffer) {    // Flush out information for old buffer.
  923.         *yy_c_buf_p = yy_hold_char;
  924.         yy_current_buffer->yy_buf_pos = yy_c_buf_p;
  925.         yy_current_buffer->yy_n_chars = yy_n_chars;
  926.     }
  927.  
  928.     yy_current_buffer = new_buffer;
  929.     yy_load_buffer_state();
  930.  
  931.     /* We don't actually know whether we did this switch during
  932.      * EOF (yywrap()) processing, but the only time this flag
  933.      * is looked at is after yywrap() is called, so it's safe
  934.      * to go ahead and always set it.
  935.      */
  936.     yy_did_buffer_switch_on_eof = 1;
  937. }
  938.  
  939.  
  940. YY_DECLARE(void) yy_load_buffer_state (void)
  941. {
  942.     yy_n_chars = yy_current_buffer->yy_n_chars;
  943.     yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
  944.     yyin = yy_current_buffer->yy_input_file;
  945.     yy_hold_char = *yy_c_buf_p;
  946. }
  947.  
  948.  
  949. YY_DECLARE(YY_BUFFER_STATE) yy_create_buffer (istream* file, int size)
  950. {
  951.     YY_BUFFER_STATE b;
  952.  
  953.     b = (YY_BUFFER_STATE) yy_flex_alloc(sizeof(struct yy_buffer_state));
  954.     if (!b)
  955.         YY_FATAL_ERROR("out of dynamic memory in yy_create_buffer()");
  956.  
  957.     b->yy_buf_size = size;
  958.  
  959.     /* yy_ch_buf has to be 2 characters longer than the size given because
  960.      * we need to put in 2 end-of-buffer characters.
  961.      */
  962.     b->yy_ch_buf = (char*) yy_flex_alloc(b->yy_buf_size + 2);
  963.     if (!b->yy_ch_buf)
  964.         YY_FATAL_ERROR("out of dynamic memory in yy_create_buffer()");
  965.  
  966.     b->yy_is_our_buffer = 1;
  967.  
  968.     yy_init_buffer(b, file);
  969.  
  970.     return b;
  971. }
  972.  
  973.  
  974. YY_DECLARE(void) yy_delete_buffer (YY_BUFFER_STATE b)
  975. {
  976.     if (!b)
  977.         return;
  978.  
  979.     if (b == yy_current_buffer)
  980.         yy_current_buffer = (YY_BUFFER_STATE) 0;
  981.  
  982.     if (b->yy_is_our_buffer)
  983.         yy_flex_free((void*) b->yy_ch_buf);
  984.  
  985.     yy_flex_free((void*) b);
  986. }
  987.  
  988.  
  989. #if !defined(YY_ALWAYS_INTERACTIVE) && !defined(YY_NEVER_INTERACTIVE)
  990. extern YY_C int isatty (int);
  991. #endif
  992.  
  993.  
  994. YY_DECLARE(void) yy_init_buffer (YY_BUFFER_STATE b, istream* file)
  995. {
  996.     yy_flush_buffer(b);
  997.  
  998.     b->yy_input_file  = file;
  999.     b->yy_fill_buffer = 1;
  1000.  
  1001. %-
  1002. #if YY_ALWAYS_INTERACTIVE
  1003.     b->yy_is_interactive = 1;
  1004. #elif YY_NEVER_INTERACTIVE
  1005.     b->yy_is_interactive = 0;
  1006. #else
  1007.     b->yy_is_interactive = file ? (isatty(fileno(file)) > 0) : 0;
  1008. #endif
  1009. %+
  1010.     b->yy_is_interactive = 0;
  1011. %*
  1012. }
  1013.  
  1014.  
  1015. YY_DECLARE(void) yy_flush_buffer (YY_BUFFER_STATE b)
  1016. {
  1017.     b->yy_n_chars = 0;
  1018.  
  1019.     /* We always need two end-of-buffer characters.  The first causes
  1020.      * a transition to the end-of-buffer state.  The second causes
  1021.      * a jam in that state.
  1022.      */
  1023.     b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
  1024.     b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
  1025.  
  1026.     b->yy_buf_pos = &b->yy_ch_buf[0];
  1027.  
  1028.     b->yy_at_bol = 1;
  1029.     b->yy_buffer_status = YY_BUFFER_NEW;
  1030.  
  1031.     if (b == yy_current_buffer)
  1032.         yy_load_buffer_state();
  1033. }
  1034. %* IS THIS NEEDED ???    CEH
  1035.  
  1036.  
  1037. #ifndef YY_NO_SCAN_BUFFER
  1038. %-
  1039. YY_BUFFER_STATE yy_scan_buffer (char* base, yy_size_t size)
  1040. {
  1041.     YY_BUFFER_STATE b;
  1042.  
  1043.     if (size < 2 || base[size-2] != YY_END_OF_BUFFER_CHAR ||
  1044.                     base[size-1] != YY_END_OF_BUFFER_CHAR)
  1045.         return 0;        // They forgot to leave room for the EOB's.
  1046.  
  1047.     b = (YY_BUFFER_STATE) yy_flex_alloc(sizeof(struct yy_buffer_state));
  1048.     if (!b)
  1049.         YY_FATAL_ERROR("out of dynamic memory in yy_scan_buffer()");
  1050.  
  1051.     b->yy_buf_size       = size - 2;    // "- 2" to take care of EOB's
  1052.     b->yy_buf_pos        = b->yy_ch_buf = base;
  1053.     b->yy_is_our_buffer  = 0;
  1054.     b->yy_input_file     = 0;
  1055.     b->yy_n_chars        = b->yy_buf_size;
  1056.     b->yy_is_interactive = 0;
  1057.     b->yy_at_bol         = 1;
  1058.     b->yy_fill_buffer    = 0;
  1059.     b->yy_buffer_status  = YY_BUFFER_NEW;
  1060.  
  1061.     yy_switch_to_buffer(b);
  1062.  
  1063.     return b;
  1064. }
  1065. %*
  1066. #endif
  1067.  
  1068.  
  1069. #ifndef YY_NO_SCAN_STRING
  1070. %-
  1071. YY_BUFFER_STATE yy_scan_string (yyconst char* str)
  1072. {
  1073.     int len;
  1074.     for (len = 0; str[len]; ++len)
  1075.         ;
  1076.  
  1077.     return yy_scan_bytes(str, len);
  1078. }
  1079. %*
  1080. #endif
  1081.  
  1082.  
  1083. #ifndef YY_NO_SCAN_BYTES
  1084. %-
  1085. YY_BUFFER_STATE yy_scan_bytes (yyconst char* bytes, int len)
  1086. {
  1087.     YY_BUFFER_STATE b;
  1088.     char* buf;
  1089.     yy_size_t n;
  1090.     int i;
  1091.  
  1092.     // Get memory for full buffer, including space for trailing EOB's.
  1093.     n = len + 2;
  1094.     buf = (char*) yy_flex_alloc(n);
  1095.     if (!buf)
  1096.         YY_FATAL_ERROR("out of dynamic memory in yy_scan_bytes()");
  1097.  
  1098.     for (i = 0; i < len; ++i)
  1099.         buf[i] = bytes[i];
  1100.  
  1101.     buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR;
  1102.  
  1103.     b = yy_scan_buffer(buf, n);
  1104.     if (!b)
  1105.         YY_FATAL_ERROR("bad buffer in yy_scan_bytes()");
  1106.  
  1107.     /* It's okay to grow etc. this buffer, and we should throw it
  1108.      * away when we're done.
  1109.      */
  1110.     b->yy_is_our_buffer = 1;
  1111.  
  1112.     return b;
  1113. }
  1114. %*
  1115. #endif
  1116.  
  1117.  
  1118. #ifndef YY_NO_PUSH_STATE
  1119. YY_DECLARE(void) yy_push_state (int new_state)
  1120. {
  1121.     if (yy_start_stack_ptr >= yy_start_stack_depth) {
  1122.         yy_size_t new_size;
  1123.  
  1124.         yy_start_stack_depth += YY_START_STACK_INCR;
  1125.         new_size = yy_start_stack_depth * sizeof(int);
  1126.  
  1127.         if (!yy_start_stack)
  1128.             yy_start_stack = (int*) yy_flex_alloc(new_size);
  1129.  
  1130.         else
  1131.             yy_start_stack = (int*) yy_flex_realloc((void*) yy_start_stack, new_size);
  1132.  
  1133.         if (!yy_start_stack)
  1134.             YY_FATAL_ERROR("out of memory expanding start-condition stack");
  1135.     }
  1136.  
  1137.     yy_start_stack[yy_start_stack_ptr++] = YY_START;
  1138.  
  1139.     BEGIN(new_state);
  1140. }
  1141. #endif
  1142.  
  1143.  
  1144. #ifndef YY_NO_POP_STATE
  1145. YY_DECLARE(void) yy_pop_state (void)
  1146. {
  1147.     if (--yy_start_stack_ptr < 0)
  1148.         YY_FATAL_ERROR("start-condition stack underflow");
  1149.  
  1150.     BEGIN(yy_start_stack[yy_start_stack_ptr]);
  1151. }
  1152. #endif
  1153.  
  1154.  
  1155. #ifndef YY_NO_TOP_STATE
  1156. YY_DECLARE(int) yy_top_state (void)
  1157. {
  1158.     return yy_start_stack[yy_start_stack_ptr - 1];
  1159. }
  1160. #endif
  1161.  
  1162. #ifndef YY_EXIT_FAILURE
  1163. #define YY_EXIT_FAILURE 2
  1164. #endif
  1165.  
  1166.  
  1167. YY_DECLARE(void) YY_FATAL_ERROR (yyconst char msg[])
  1168. {
  1169. %-
  1170.     (void) fprintf(stderr, "%s\n", msg);
  1171. %+
  1172.     cerr << msg << '\n';
  1173. %*
  1174.     exit(YY_EXIT_FAILURE);
  1175. }
  1176.  
  1177.  
  1178. // Redefine yyless() so it works in section 3 code.
  1179.  
  1180. #undef yyless
  1181. #define yyless(n)    do { \
  1182.         /* Undo effects of setting up yytext. */ \
  1183.         yytext[yyleng] = yy_hold_char; \
  1184.         yy_c_buf_p = yytext + n - YY_MORE_ADJ; \
  1185.         yy_hold_char = *yy_c_buf_p; \
  1186.         *yy_c_buf_p = '\0'; \
  1187.         yyleng = n; \
  1188.     } while (0)
  1189.  
  1190.  
  1191. // Internal utility routines.
  1192.  
  1193. #ifndef yytext_ptr
  1194. static void
  1195. yy_flex_strncpy (char* s1, yyconst char* s2, int n)
  1196. {
  1197.     register int i;
  1198.     for (i = 0; i < n; ++i)
  1199.         s1[i] = s2[i];
  1200. }
  1201. #endif
  1202.  
  1203.  
  1204. static void*
  1205. yy_flex_alloc (yy_size_t size)
  1206. {
  1207.     return (void*) malloc(size);
  1208. }
  1209.  
  1210. static void*
  1211. yy_flex_realloc (void* ptr, yy_size_t size)
  1212. {
  1213.     return (void*) realloc(ptr, size);
  1214. }
  1215.  
  1216. static void
  1217. yy_flex_free (void* ptr)
  1218. {
  1219.     free(ptr);
  1220. }
  1221.  
  1222. #if YY_MAIN
  1223. int
  1224. main (void)
  1225. {
  1226.     yylex();
  1227.     return 0;
  1228. }
  1229. #endif
  1230.